package com.ybwh.outterapi.codec;

import java.security.NoSuchAlgorithmException;

public class DefaultDataCrypto implements DataCrypto {
    @Override
    public byte[] encrypt(String appSecret, byte[] data) {
        return AESUtil.encrypt(data, appSecret);
    }

    @Override
    public byte[] decrypt(String appSecret, byte[] data) {
        return AESUtil.decrypt(data, appSecret);
    }

    @Override
    public String hashHex(byte[] data) {
        try {
            return SHA256Utils.encrypt(data);
        } catch (NoSuchAlgorithmException e) {
            throw new RuntimeException(e);
        }
    }
}
